<template>
	<view>
		<view class="top">
			<image src="../../static/logo.png" mode=""></image>
			<view class="text">浏览历史</view>
		</view>
		
		<view class="content">
			<newsBox v-for="(item,index) in newsArr" :key="item.id" @click.native="goDetail(item)" :item='newsArr[index]'></newsBox>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'index',
				newsArr:[]
			}
		},
		onShow(){
			this.getHSDate()
		},
		methods: {
			goDetail(evt){
				uni.navigateTo({
					url:`/pages/detail/detail?cid=${evt.classid}&id=${evt.id}`
				})
			},
			
			
			// 获取新闻列表 
			getHSDate(){
				// uni.request({
				// 	url:'https://ku.qingnian8.com/dataApi/news/newslist.php',
				// 	success: res => {
						
				// 		this.newsArr = res.data
				// 		console.log(this.newsArr)
				// 	}
				// })
				this.newsArr = uni.getStorageSync('historyArr')
				console.log(this.newsArr)
			}
		}
		
	}
</script>

<style lang="scss" scoped>
	.top {
		padding: 50rpx 0;
		background-color: #f8f8f8;
		color: #555;
		display: flex;
		flex-direction: column;
		// background-color: pink;
		// 垂直居中
		justify-content: center;
		// 水平居中
		align-items: center;
		image {
			width: 150rpx;
			height: 150rpx;
		}
		.text {
			font-size: 38rpx;
		}
	}
</style>
